<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="jquery-3.1.1.min.js"></script>
    <script src="jquery.json.js"></script>

    <script>
        function loadData() {
            $.getJSON("http://online.izhikang.com:9011/api/wechat/1/campaigns?grade=&form_type=&page=1&per_page=10",function (data) {
                var name = '';
//                var json = $.toJSON(data);
//                for (var i = 0 ; i < $.evalJSON(json).data.campaigns.length;i++)
                for (var i = 0 ; i < data.data.campaigns.length;i++)
                {
                    name += data.data.campaigns[i].name + "<br>";
                }
                $("#info").html(name);
            });
        }
        
        function testAjax() {
            $('#info').load("http://online.izhikang.com:9011/api/wechat/1/campaigns?grade=&form_type=&page=1&per_page=10",function (a,b,c) {
                alert(a);
                alert(b);
                alert(c.status +"   "+c.statusText );
            })
        }

        function testGet() {
            $.get("http://online.izhikang.com:9011/api/wechat/1/campaigns?grade=&form_type=&page=1&per_page=10",function (data,status) {
                alert(data.data.campaigns[0].campaign_form.broadcast_play_count);
                alert(status);
            })

        }



//            $(document).ready(function () {
//                $("button").click(function () {
//                    $("p").toggle(1000);
//                });
//            });

        function testsettimeout() {
            var flag = false;
            var time = setTimeout(function () {
                flag = true;
                alert("1");
            },3000);

            setTimeout(function () {
               if(time){
                    alert("@");
               }
            },1000)
        }

    </script>
</head>
<body onload="testsettimeout()">
<button onclick="loadData()">click me</button>
<p id="info">123123</p>
</body>
</html>